package com.cn.service.impl;

import com.cn.dao.UserDao;
import com.cn.dao.impl.UserDaoImpl;
import com.cn.domain.User;
import com.cn.service.UserService;

public class UserServiceImpl implements UserService{
	private UserDao userDao; 
	public UserServiceImpl() {
		userDao=new UserDaoImpl();
	}
	//按照名字查找用户名字,email,identity,telphone
	@Override
	public User queryUserByKey(String key,String value) {
		return userDao.queryUserByKey(key, value);
	}
	@Override
	public int addUser(User user) {
		int row=0;
		//先判断这里是否有相同的用户
		return userDao.addUser(user);
	}
	
	//按照用户名和密码验证
	@Override
	public User queryUserByNameAndPwd(User user) {
		return userDao.queryUserByNameAndPwd(user);
	}
	
	//找回密码（按照name，eaiml，id进行更新密码）
	@Override
	public int updateNewPwd(User user) {
		return userDao.updateNewPwd(user);
	}
	@Override
	public User queryUserByIdAndEmail(User user) {
		return userDao.queryUserByIdAndEmail(user);
	}
}
